package com.uppfind.framework.dao.api.common;

/**
 * 排序
 */
public class Sort {

    /**
     * 属性
     */
    private String property;

    /**
     * order 增减
     */
    private String order = SortType.asc.getValue();

    public Sort() {
    }

    public String getOrder() {
        if (order == null) {
            return SortType.asc.getValue();
        }
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public void asc() {
        this.order = "asc";
    }

    public void desc() {
        this.order = "desc";
    }

    public String getProperty() {
        return property;
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public enum SortType {
        asc(1, "asc"),
        desc(2, "desc");

        public Integer code;
        public String value;

        SortType(Integer code, String value) {
            this.code = code;
            this.value = value;
        }

        public Integer getCode() {
            return this.code;
        }

        public String getValue() {
            return this.value;
        }
    }
}
